package com.example.springboot014blogadmin.model.param;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

/**
 * @description: TODO
 * @author: uu
 * @data: 2023/7/9 下午 02:31
 * @version: v1.0
 */
@Data
public class ArticleParam {
    public static interface AddArticle {}
    public static interface EditArticle{}
    @NotNull(message = "修改时必修有id", groups = EditArticle.class)
    @Min(value = 1, message = "id 必须从{value}开始" , groups = EditArticle.class)
    private Integer id;

    @NotBlank(message = "请输入文章标题", groups = {EditArticle.class, AddArticle.class})
    @Size(min = 2, max = 20, message = "文章标题{min} -{max}", groups = {AddArticle.class, EditArticle.class})
    private String title;

    @NotBlank(message = "请输入文章的副标题", groups = {AddArticle.class, EditArticle.class})
    @Size(min = 5, max = 30, message = "文章副标题{min} - {max}", groups ={AddArticle.class, EditArticle.class} )
    private String summary;

    @NotBlank(message = "请输入文章内容", groups ={AddArticle.class, EditArticle.class} )
    @Size(min = 10, max = 8000, message = "文章至少五十字，文章最多8000字", groups = {AddArticle.class, EditArticle.class} )
    private String content;

}
